<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.twoscreen.TUser"%>
<%@ page import="com.twoscreen.Points"%>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
<%
	//Variables
	UserService userService = UserServiceFactory.getUserService();
	User user = userService.getCurrentUser();
	String thisURL = request.getRequestURL().toString();
	TUser tuser = null;
	String username = null;
	String points = null;
	String correctAnswers = null;

	if (user != null) {
		tuser = TUser.getTUser(user);
		username = tuser.getUserName();
		points = Points.getPointsTotal(tuser);
	}
%>
<!doctype html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="cache-control" content="no-store, no-cache, must-revalidate, max-age=1" />
		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="expires" value="1" />
		<title>Two-Screen | Cookie Policy</title>
		<link rel="shortcut icon" href="/images/favicon.ico" />
		<link href='https://fonts.googleapis.com/css?family=Montserrat|Exo:200,400' rel='stylesheet' type='text/css' />
		<link href="/css/web.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" type="text/css" href="/css/jquery.fancybox.css?v=2.1.2" media="screen" />
		<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="/js/jquery.fancybox.js?v=2.1.3"></script>
		<script type="text/javascript" src="/js/userUpdateWeb.js"></script>
		<script type="text/javascript" src="/js/cufon-yui.js"></script>
		<script type="text/javascript" src="/js/College_700.font.js"></script>
		<script type="text/javascript">
			Cufon.replace('h1#logo');
		</script>
		<script type="text/javascript">
			var _gaq = _gaq || [];
			_gaq.push(['_setAccount', 'UA-35281811-1']);
			_gaq.push(['_trackPageview']);
			
			(function() {
			  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
			  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
			})();
		</script>
	</head>
	<body onload="" onunload="">
	
		<div id="head-bg">
			<div class="inner-wrapper">
				<div id="header">
					<div id="head-logo">
						<a href="/"><img id="logo" alt="home" src="/images/logo2.png" /></a>
						<h1 id="logo"><a href="/">Two-screen</a></h1>
					</div>
					<ul class="menu">

<% 
	if (user != null) {
%>
				
						<li id="head-user">
							<h3 class="menu">you</h3>
							<ul class="head-sub">
								<li class="noHover"><h3>points: <%= points %></h3></li>
								<li><h3><a class="fancybox" href="#username-update-dialog">update username</a></h3></li>
								<li><h3>
										<a class="head-link" href="<%= userService.createLogoutURL(thisURL) %>">log out</a>
									</h3>
								</li>
							</ul>
						</li>
						

<% 
	} else {
%>
				
						<li id="head-user">
							<h3 class="menu"><a class="head-link" href="<%= userService.createLoginURL(thisURL) %>">log in</a></h3>
						</li>
				
<% 
	}
%>				
				
					
						<li id="head-explore">
							<h3 class="menu"><a class="head-link" href="/connect.jsp">watch</a></h3>
						</li>
						
						
						<li id="head-create">
							<h3 class="menu"><a class="head-link" href="/producers/index.jsp">create</a></h3>
						</li>
					</ul>
					
				</div>
				<div class="clear"></div>
			</div>
		</div>
	
		<div id="home-bg">
			<div class="inner-wrapper">
				<h1>Terms and conditions</h1>
				<p>You are deemed to be in agreement with the terms and conditions, altered from time to time, on this page
					by using this website</p>
				<h3>Information you submit</h3>
				<p>When you submit information to this site we will work on the basis, unless you clearly state otherwise, 
				that you are granting Two-Screen a non-exclusive, irrevocable right to use and pass on all public 
				information that you submit (for example pictures you add and content you create) as well 
				as the right to allow the re-use of that information. This is so that we can place the contents of this 
				site under the same permissive licence terms as above. Your ideas remain your own.</p>
				<h3>Links to other websites</h3>
				<p>Please note that Two-Screen takes no responsibility for the content of any of the 
					external websites we link to from this website.</p>
			</div>
		</div>
		<div id="username-update-dialog" style="width:400px;display: none;">
			<h3>Update user name: <span id="currentUn"><%= username %></span></h3>
			<br>
			<label for="username">User name:</label><input type="text" name="username" id="username-input">
			<br>
			<p id="unError"></p>
			<div id="unSuggestions"></div>
			<button type="button" onclick="userSave()">Save</button>
		</div>
		<div id="username-success" style="width:400px;display: none;">
			<h3 class="success">User name saved</h3>
		</div>
		
		<%@ include file="/include/footer.html" %>
		
	</body>
</html>